class MusicPlayer(object):
    instance = None
    init__called = False

    def __new__(cls, *args, **kwargs):
        if cls.instance is None:
            print("创建对象,分配空间")
            cls.instance = super().__new__(cls)  # 创建对象,分配空间
        return cls.instance

    def __init__(self):
        if not MusicPlayer.init__called:
            MusicPlayer.init__called = True
            print("初始化对象,给对象绑定属性")
            self.name = "播放器"


if __name__ == '__main__':
    player1 = MusicPlayer()
    print("-" * 20)
    player2 = MusicPlayer()
    print("-" * 20)
    print(player1 is player2)
    print(id(player1))
    print(id(player2))